<script setup lang="ts">

import {digElMessage} from "../common/Message.ts";
import {ref,defineEmits} from "vue";

const props=defineProps<{
   password:string,
  username:string
}>();

const emit=defineEmits<{
  (e:"show"):boolean
}>()


let confirepassword=ref("")


const ensuerPassword=()=>{
  if(confirepassword.value!==props.password){
      digElMessage("密码错误","warning",900)
  }

  else{
      emit("show",false);
  }
}
</script>

<template>

  <div class="login-form">

   来自 <el-button text type="primary">{{props.username}}</el-button>的分享
    <div class="form-item form-tel">


      <el-input type="password" v-model="confirepassword"  maxlength="64" placeholder="请输入密码"/>
      <img src="https://sf3-scmcdn2-tos.pstatp.com/xitu_juejin_web/img/greeting.1415c1c.png" class="greeting">
    </div>

    <img src="https://sf3-scmcdn2-tos.pstatp.com/xitu_juejin_web/img/normal.0447fe9.png" class="normal">
    <button class="btn-submit" @click="ensuerPassword">确定</button>
  </div>
</template>

<style scoped>

*{
  margin: 0;
  padding: 0;
}
body{
  background-color: #e9e9e9;
}
.login-form {
  width: 370px;
  margin: 100px auto;
  padding: 24px;
  background-color: #fff;
  position: relative;
  .el-button{

    font-size: 18px;

  }
  .el-input {
    outline: none;
    padding: 10px;
    margin-bottom: 10px;
    width: 100%;

    border-radius: 2px;
    outline: none;
    box-sizing: border-box;
    font-size: 16px;
    border: none;
  }
  input:focus{
    border-color: #007fff;
  }
  img{
    width: 120px;
    height: 95px;
    position: absolute;
    top: 0;
    left: 50%;
    transform: translate(-50%,-50%);
  }
  .form-tel img{
    height: 113px;
  }
  .form-password img{
    width: 103px;
    height: 84px;
  }
  .form-item img{
    display: none;
  }
  .form-item:focus-within ~ img{
    display: none;
  }
  .form-item:focus-within {
    img {
      display: block;
    }
  }
  .btn-submit{
    align-items: center;
    width: 100%;
    height: 40px;
    color: #fff;
    background-color: #007fff;
    border-radius: 2px;
    outline: none;
    box-sizing: border-box;
    cursor: pointer;
    margin-top: 10px;
    border: none;
    padding: 8px 20px;
  }
}
</style>